package com.qhy.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author qiuhongyu
 * @date 2020/11/3 17:40
 */
@RestController
@RefreshScope  //config刷新的注解
public class ConfigClientController {
    @Value("${spring.application.name}")
    private String applicationName;

    @Value("${eureka.client.service-url.defaultZone}")
    private String eurekaUrl;

    @Value("${server.port}")
    private String port;

    @GetMapping("/config")
    public String getString() {
        String str = applicationName + "===" + eurekaUrl + "===" + port;
        return str;
    }

}
